/*
 * Small aux program to store student id into file
 * to be used as root.root with +s set
 */

// file that contains the room that the candidate is located in
char candidate_fn[] = "/etc/digeks/room";

#include <stdlib.h>
#include <stdio.h>


main(int argc, char *argv[])
{
  FILE *cfile = NULL;

  if (argc != 2) {
    fprintf(stderr,"Wrong number of arguments: %d\n",argc);
    return(-1);
  }
  if(!(cfile = fopen(candidate_fn,"w"))){
    fprintf(stderr,"cannot open %s\n",candidate_fn);
    return(-1);
  }

  fprintf(cfile,"%s\n",argv[1]);
  fclose(cfile);
  
  return(0);
} /* main */
